package cts;

import grammer.components.ObjectEnum;
import houseHold.House;
import houseHold.Room;

import java.io.File;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Set;

import javax.swing.JFrame;

import sensor.Sensor;
import simulation.WriterCollection;
import toXML.LoadFamilyXML;
import toXML.LoadHouseXML;


public class ttt {
	
	public static void main(String args[])
	{
		File house = new File("somehouse2.xml");
		LoadHouseXML.loadXML(house);
		TabContainer t=GUIBuilder.execute();
		JFrame f=new JFrame();
		f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		f.add(t);
		f.setSize(800,600);
		f.setVisible(true);
		Room r=House.getInstance().getRoom(0);
		r.getItemByType(ObjectEnum.LIGHT).setActive(true);
		HashMap<String,Sensor> s=House.getInstance().getRoom(0).getSensors();
		Set<String> st=s.keySet();
		WriterCollection.startAll();
		for(int i=20000;i<50000;i+=50){
		Iterator<String> it=st.iterator();
		while(it.hasNext())
		{
			s.get(it.next()).getSensorData(r, i);
		}
		}
		WriterCollection.stopAll();
	}

}
